using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using System;

public class RoomItemUI : MonoBehaviour
{

    public Text CountText;
    public Text Player1Text;
    public Text Player2Text;
    public Text RoomIdText;
    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        
    }

    public void JoinRoom() {
        Game.Instance.Logic.Data.JoinedRoomID = int.Parse(RoomIdText.text);
        Network.Instance.Connect("127.0.0.1", 10086);
        var b = pb.C2S_ConnectMsg.CreateBuilder();

        b.SetBattleID((UInt64)Game.Instance.Logic.Data.JoinedRoomID);
        b.SetPlayerID(Game.Instance.Logic.Data.MyID);
        b.SetToken("");
        Network.Instance.client.Send(PacketWraper.NewPacket(pb.ID.MSG_Connect, b.Build()));
    }
}
